/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Review.test3;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author THIEN
 */
public class ThreadOne extends MyThread{

    public ThreadOne(Data d) {
        super(d);
    }

    @Override
    public void run(){
        this.getData();
    }
    public void getData(){
        for(int i  = 0;i<3;i++){
            synchronized(this.d){
                if(!d.flag){
                    String[] data = d.getData();
                    d.temp = data[i];
                    d.flag = true;
                    d.notify();
                }
                try {
                    d.wait();
                } catch (InterruptedException ex) {
                    Logger.getLogger(ThreadOne.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
    }



}
